//#########################################################################
//                              WackiEngie
//           Copyright (c) 2014 Marc Wacker. All rights reserved.
//#########################################################################

#pragma once

#include "WeCorePrerequisites.h"
#include "WeInputTypes.h"

namespace WackiEngine
{

	class InputEvent
	{
	public:
		mutable bool isUsed;

		InputEvent()
			: isUsed(false)
		{ }

	};


	enum KeyEventType
	{
		KE_Press		= 0x01,
		KE_Release		= 0x02,
		KE_Repeat		= 0x04,
		KE_DoubleClick	= 0x08,
		KE_Count
	};

	class KeyEvent : public InputEvent
	{
	public:
		KeyEvent(KeyCode key, KeyEventType type = KE_Press, int32 mods = Mod_None, uint32 deviceId = 0)
			: key(key), type(type), mods(mods), deviceId(deviceId)
		{ }

		KeyCode			key;
		KeyEventType	type;
		int32			mods;
		uint32			deviceId;

		bool			isShiftDown() const { return (mods & Mod_Shift) != 0; }
		bool			isCtrlDown() const { return (mods & Mod_Ctrl) != 0; }
		bool			isAltDown() const { return (mods & Mod_Alt) != 0; }
		bool			isSuperDown() const { return (mods & Mod_Super) != 0; }
	};

	class AxisEvent : public InputEvent
	{
	public:
		AxisEvent(KeyCode key, float value, uint32 deviceId = 0)
			: key(key), value(value), deviceId(deviceId)
		{ }

		KeyCode			key;
		float			value;
		uint32			deviceId;
	};

	class PointerEvent : public InputEvent
	{
	public:
		PointerEvent(float x, float y, float deltaX, float deltaY, KeyCode button = KC_Mouse_Left, int32 mods = Mod_None)
			: x(x), y(y), deltaX(deltaX), deltaY(deltaY), button(button), mods(mods)
		{ }

		float		x;
		float		y;
		float		deltaX;
		float		deltaY;
		KeyCode		button;
		int32		mods;
	};
	
	class CharInputEvent : public InputEvent
	{
	public:
		CharInputEvent(uint32 textChar)
			: textCharacter(textChar)
		{ }

		uint32 textCharacter;
	};





}